{extend name="../template/admin/head.html"}
{block name="title"}
网站设置_{__block__}
{/block}
{block name="content"}
     <blockquote class="layui-elem-quote title" style="margin-left:10px;margin-top:10px;"><h2>网站设置</h2></blockquote>
<form class="layui-form">
    <table class="layui-table">
      <colgroup>
        <col width="20%">
        <col width="50%">
        <col>
        </colgroup>
        <thead>
          <tr>
            <th>参数说明</th>
            <th>参数</th>
          </tr>
        </thead>

        <tbody>
          <tr>
            <td>网站名称</td>
            <td><input type="text" class="layui-input cmsName" lay-verify="required" placeholder="请输入网站名称" id="webname" value="{$res.webname}"></td>
          </tr>
          <tr>
            <td>默认关键字</td>
            <td><input type="text" class="layui-input keywords" placeholder="请输入默认关键字" id="keyword" value="{$res.keyword}"></td>
          </tr>
          <tr>
            <td>版权信息</td>
            <td><input type="text" class="layui-input powerby" placeholder="请输入网站版权信息" id="copyright" value="{$res.copyright}"></td>
          </tr>
          
          <tr>
            <td>网站备案号</td>
            <td><input type="text" class="layui-input record" placeholder="请输入网站备案号" id="kor" value="{$res.kor}"></td>
          </tr>
          <tr>
            <td>网站描述</td>
            <td><textarea placeholder="请输入网站描述" class="layui-textarea description" id="describe">{$res.description}</textarea></td>
          </tr>
          <tr>
            <td>网站底部</td>
            <td><textarea placeholder="统计代码等" class="layui-textarea description" id="bottom">{$res.bottom}</textarea></td>
 
          </tr>
        </tbody>
    </table>
    <div class="layui-form-item" style="text-align: right;">
      <div class="layui-input-block">
        <button class="layui-btn kit-login-btn" lay-submit="submit" lay-filter="reset" id="submit">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
  </form>
  {/block}
{block name="jssrc"}
<script type="text/javascript">
//JavaScript代码区域
//监听提交数据
layui.use('form', function(){
  var form = layui.form;         
 form.on('submit(reset)', function(data) {
  var webname = $("#webname").val();
  var keyword = $("#keyword").val();
  var copyright = $("#copyright").val();
  var kor = $("#kor").val();
  var describe = $("#describe").val();
  var bottom = $("#bottom").val();
        $.ajax({
          type:"POST",
          url:"{:URL('Systemset/systemsetpost')}",
          dataType:"json",
          data:{webname:webname,keyword:keyword,copyright:copyright,kor:kor,describe:describe,bottom:bottom},
          beforeSend: function () {
            // 禁用按钮防止重复提交
            $("#reset").attr({"disabled":"disabled"});
            $("#reset").addClass("layui-btn-disabled");
            $("#reset").html("提交中...");
            },
           error: function (XmlHttpRequest, textStatus, errorThrown) {
              if (XmlHttpRequest.responseText != "") {
                  layer.msg('提交失败，请稍后尝试！');
                  $("#reset").removeClass("layui-btn-disabled");
                  $("#reset").removeAttr("disabled");  
                  $("#reset").html("立即提交");
              }
          },
          success:function(data){
            //1为修改成功
            //2为修改失败
            if (data.result == "1") {
              layer.msg(data.msg);
              $("#reset").removeClass("layui-btn-disabled");
              $("#reset").removeAttr("disabled");  
              $("#reset").html("立即提交");
              setTimeout(function(){
                location.reload();
              },1000);
            }else if(data.result = "2"){
              layer.msg(data.msg);
              $("#reset").removeClass("layui-btn-disabled");
              $("#reset").removeAttr("disabled");  
              $("#reset").html("立即提交");
            }
              setTimeout(function(){
                location.reload();
              },1000);
          }
        });
        return false;
});
}); 
</script>
{/block}